Skip to content

feat(command): add version command and Discord application integration - #473

Merged
Akinator31 merged 3 commits into
mainfrom
428-version-command
Sep 7, 2026
Merged

feat(command): add version command and Discord application integration#473
Akinator31 merged 3 commits into
mainfrom
428-version-command

Conversation

@Akinator31

Copy link
Copy Markdown
Member

This pull request introduces a new update-checking feature and a user-facing version command to Rustmail, along with related configuration options and API endpoints. It also includes internationalization support for these features and ensures robust configuration handling and testing.

Update Checking Feature:

  • Added an [updates] section to the config file, allowing configuration of update checks (enabled, check interval, and notification channel).
  • Integrated update checker startup in the bot's ready handler, so update checks run automatically if enabled.
  • Added validation for the update check interval and ensured default values are used if the section is missing, with tests for config parsing and serialization.

Version Command and API:

  • Implemented a new /version API endpoint that returns current and latest version info, update availability, and related metadata (crates/rustmail/src/api/handler/bot/version.rs, [1] [2].
  • Added a user command (!version/!v) and slash command for checking the running Rustmail version, with appropriate registration and handlers.

Internationalization:

  • Added English and French translations for the new version command and update messages, including help text and command descriptions.

Config and API Integration:

  • Extended the config API and related handlers to support the new updates section, ensuring it is loaded, saved, and updated correctly.
  • Updated tests and internal code to use the new config structure.

Testing and Robustness:

  • Added tests to ensure config backward compatibility and correct TOML round-tripping for the [updates] section.

These changes collectively add a robust update-checking mechanism and a user-accessible version command, with full config, API, and internationalization support.

@Akinator31 Akinator31 linked an issue Sep 6, 2026 that may be closed by this pull request
@Akinator31 Akinator31 self-assigned this Sep 6, 2026
@Akinator31
Akinator31 requested a lite review from Copilot September 7, 2026 06:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are a couple of concrete correctness/behavior issues (banner ignoring check_enabled, redundant command registration) that should be fixed before merge.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adds an update-checking subsystem to Rustmail and exposes version/update status through both Discord commands and the web panel, backed by new config and API surfaces.

Changes:

  • Introduces an [updates] config section (types + parsing/validation), persists update check metadata, and starts a background update checker on bot ready.
  • Adds “version” surfaces: Discord text + slash/user commands, and a /api/bot/version endpoint returning current/latest/update metadata.
  • Adds a web-panel update banner plus panel/wizard UI and i18n strings to configure and display update status.
File summaries
File Description
docs/reference/configuration.md Documents new [updates] config section and behavior.
docs/guides/commands.md Documents the new version command across surfaces.
crates/rustmail/src/setup/handlers/save.rs Adds setup wizard support for enabling update checks.
crates/rustmail/src/modules/update_checker.rs Implements periodic GitHub release polling + announcement + metadata storage.
crates/rustmail/src/modules/mod.rs Exposes update_checker module and re-exports.
crates/rustmail/src/main.rs Reuses shared CURRENT_VERSION constant.
crates/rustmail/src/i18n/language/fr.rs Adds FR strings for version command and update announcement.
crates/rustmail/src/i18n/language/en.rs Adds EN strings for version command and update announcement.
crates/rustmail/src/handlers/ready_handler.rs Starts update checker when bot becomes ready (guarded).
crates/rustmail/src/handlers/guild_messages_handler.rs Registers !version / !v text command.
crates/rustmail/src/config.rs Adds updates to runtime config + validation + tests.
crates/rustmail/src/commands/version/text_command/version.rs Implements !version / !v handler.
crates/rustmail/src/commands/version/text_command/mod.rs Wires text-command module exports.
crates/rustmail/src/commands/version/slash_command/version.rs Implements /version + user context command registration/handler.
crates/rustmail/src/commands/version/slash_command/mod.rs Wires slash-command module exports.
crates/rustmail/src/commands/version/mod.rs Adds version command module root.
crates/rustmail/src/commands/version/common.rs Shared content builder for version output.
crates/rustmail/src/commands/mod.rs Exposes version commands from the commands module.
crates/rustmail/src/commands/edit/common.rs Updates test config construction to include updates.
crates/rustmail/src/bot.rs Registers VersionCommand in command registry.
crates/rustmail/src/api/routes/bot.rs Adds /api/bot/version route.
crates/rustmail/src/api/handler/bot/version.rs Adds version/status API handler reading metadata from DB.
crates/rustmail/src/api/handler/bot/mod.rs Exposes new version handler module.
crates/rustmail/src/api/handler/bot/config.rs Extends config API to include updates.
crates/rustmail_types/src/config/updates.rs Defines UpdateConfig type and defaults.
crates/rustmail_types/src/config/mod.rs Exports UpdateConfig.
crates/rustmail_types/src/api/mod.rs Extends ConfigResponse and adds VersionInfo.
crates/rustmail_panel/src/pages/panel.rs Mounts the update banner in the panel layout.
crates/rustmail_panel/src/i18n/fr/fr.json Adds FR panel strings for updates section/banner + wizard toggle.
crates/rustmail_panel/src/i18n/en/en.json Adds EN panel strings for updates section/banner + wizard toggle.
crates/rustmail_panel/src/components/wizard/types.rs Adds check_updates field to wizard state.
crates/rustmail_panel/src/components/wizard/step6_review.rs Sends check_updates to setup save endpoint.
crates/rustmail_panel/src/components/wizard/step5_language.rs Adds wizard UI toggle for update checks.
crates/rustmail_panel/src/components/update_banner.rs Implements update-available banner fetching /api/bot/version.
crates/rustmail_panel/src/components/mod.rs Exposes update_banner component module.
crates/rustmail_panel/src/components/configuration.rs Adds “Updates” accordion section and form controls.
config.example.toml Adds example [updates] section.
Review details
  • Files reviewed: 37/37 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/rustmail_panel/src/components/update_banner.rs Outdated
Comment on lines +30 to +41
let latest = get_system_metadata("latest_known_version", &pool)
.await
.ok()
.flatten();
let release_url = get_system_metadata("latest_release_url", &pool)
.await
.ok()
.flatten();
let last_checked = get_system_metadata("last_update_check", &pool)
.await
.ok()
.flatten();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 371be47: metadata keys are now centralized via shared constants from update_checker and reused in this handler.

Comment thread crates/rustmail/src/bot.rs Outdated
Co-authored-by: Akinator31 <99099121+Akinator31@users.noreply.github.com>
@Akinator31
Akinator31 merged commit d6298d0 into main Sep 7, 2026
2 checks passed
@Akinator31
Akinator31 deleted the 428-version-command branch September 7, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Version command

3 participants